﻿#region Using Directives

    using System;

    using Csla;

    using MarketPulse.BusinessLogic.Core;

#endregion

namespace MarketPulse.Reporting.Core
{
    /// <summary>
    /// This Enum contains the various types of ReportingLevels.
    /// </summary>
    [Serializable]
    public enum ReportingLevelType
    {
        /// <summary>
        /// A company type reporting level
        /// </summary>
        Company,

        /// <summary>
        /// A branch type reporting level
        /// </summary>
        Branch
    }

    /// <summary>
    /// This class represents a read only instance of a read only Reporting Level within the system.
    /// </summary>
    [Serializable]
    public class ReportingLevelInfo : MarketPulseReadOnlyBase<ReportingLevelInfo>
    {

        #region Constructors

            /// <summary>
            /// Default constructor is private in order to (try to) enforce construction
            /// only via the static factory methods provided.
            /// </summary>
            private ReportingLevelInfo()
            {
            }

        #endregion       

        #region Properties

            /// <summary>
            /// Whether this ReportingLevelInfo object is currently selected, this is not persisted. Defaulted to true.
            /// </summary>
            public bool Selected = true;

            /// <summary>
            /// The Name/Label of this ReportingLevelInfo object.
            /// </summary>
            public static PropertyInfo<Nullable<Guid>> ParentReportingLevelGUIDProperty = RegisterProperty<Nullable<Guid>>(p => p.ParentReportingLevelGUID);
            /// <summary>
            /// The Name/Label of this ReportingLevelInfo object.
            /// </summary>
            public Nullable<Guid> ParentReportingLevelGUID
            {
                get { return GetProperty(ParentReportingLevelGUIDProperty); }
            }

            /// <summary>
            /// The Name/Label of this ReportingLevelInfo object.
            /// </summary>
            public static PropertyInfo<string> NameProperty = RegisterProperty<string>(p => p.Name);
            /// <summary>
            /// The Name/Label of this ReportingLevelInfo object.
            /// </summary>
            public string Name
            {
                get { return GetProperty(NameProperty); }
            }

            /// <summary>
            /// The Type of ReportingLevel this ReportingLevelInfo instance represents.
            /// </summary>
            public static PropertyInfo<ReportingLevelType> TypeProperty = RegisterProperty<ReportingLevelType>(p => p.Type);
            /// <summary>
            /// The Type of ReportingLevel this ReportingLevelInfo instance represents.
            /// </summary>
            public ReportingLevelType Type
            {
                get { return GetProperty(TypeProperty); }
            }

            /// <summary>
            /// The ReportingLevelInfo items that are children of this ReportingLevel.
            /// </summary>
            public static PropertyInfo<ReportingLevelInfoList> ChildrenProperty = RegisterProperty<ReportingLevelInfoList>(p => p.Children);
            /// <summary>
            /// The ReportingLevelInfo items that are children of this ReportingLevel.
            /// </summary>
            public ReportingLevelInfoList Children
            {
                get { return GetProperty(ChildrenProperty); }
            }

        #endregion

    }
}
